<script>
export default {
	onLaunch: function(es) {
		// #ifdef MP-WEIXIN
		uni.loadFontFace({
			family: 'font-art',
			source: `url("${this.$u.http.config.baseUrl + '/static/iconfont/artnew.ttf'}")`,
			success(res) {
				console.log(res);
			},
			fail(res) {
				console.log(res);
			}
		});
		// #endif

		this.$u.api.config().then(res => {
			this.$u.vuex('vuex_site_config', res);
		});

		// #ifdef H5

		// #endif

		// #ifdef MP
		uni.login({
			success: async e => {
				let { token, userInfo } = await this.$u.api.login(e);
				this.$u.vuex('vuex_token', token);
				this.$u.vuex('vuex_user', userInfo);
				this.getmy_space(es);
				// if (es.query) {
				// 	if (!es.query.my_space_id) {
				// 		this.getmy_space(es);
				// 	}
				// } else {
				// 	this.getmy_space();
				// }
			}
		});
		// #endif
	},
	onShow: function() {},
	onHide: function() {},
	methods: {
		async getmy_space(e) {
			let res = await this.$u.api.my_space();
			if (e.query) {
				// my_space_id 邀请开通空间
				// my_subject_id 答题
				// volume_id 情侣卡
				// uni.redirectTo({
				// 	url:'/'+e.path+'?'+e.query.split('{')[1].split('}')[0]
				// })
			}
			if (res.length != 0 && res[0].ta_user_id != 0) {
				if (e.path == 'pages/index/index') {
					uni.switchTab({
						url: '/pages/content/content'
					});
				}
			}
		}
	}
};
</script>

<style lang="scss">
/* 注意要写在第一行，同时给style标签加入lang="scss"属性 */
@import 'uview-ui/index.scss';
// @import url("@https://yunkeososyunchuc.bc8t.cn/lianaikongjian/static/stylesheet.css")
</style>
<style>
.uni-tabbar {
	background-color: transparent !important;
}

/*每个页面公共css */
.flex {
	display: flex;
	flex-wrap: wrap;
}
.w50 {
	width: 50%;
	box-sizing: border-box;
	padding: 20px;
}
.w33 {
	width: 33.3%;
}
.w25 {
	width: 25%;
}
.j-t {
	justify-content: center;
}
.f12 {
	font-size: 12px;
}
.f14 {
	font-size: 14px;
}
.f16 {
	font-size: 16px;
}
.fb {
	font-weight: bold;
}
.a-t {
	align-items: center;
}
.bg {
	color: rgb(241, 158, 194);
}
.c {
	color: #fa1e8a;
}
.b1 {
	color: #fa1e8a;
	font-size: 30px;
}
.cf {
	color: #fff;
}
.box {
	box-sizing: border-box;
	padding: 10px;
}
.c999 {
	color: #999;
}
.c333 {
	color: #333;
}
.c6 {
	color: #666;
}
.b {
	color: #409eff;
}
.button {
	background: #fa1e8a;
	color: #fff;
	border-radius: 30px;
}
.animat {
	position: relative;
	animation: mymove 2s infinite;
	-webkit-animation: mymove 2s infinite; /*Safari and Chrome*/
	animation-direction: alternate; /*轮流反向播放动画。*/
	animation-timing-function: ease-in-out; /*动画的速度曲线*/
	/* Safari 和 Chrome */
	-webkit-animation: mymove 2s infinite;
	-webkit-animation-direction: alternate; /*轮流反向播放动画。*/
	-webkit-animation-timing-function: ease-in-out; /*动画的速度曲线*/
}
@keyframes mymove {
	0% {
		transform: scale(1); /*开始为原始大小*/
	}
	25% {
		transform: scale(1.1); /*放大1.1倍*/
	}
	50% {
		transform: scale(1);
	}
	75% {
		transform: scale(1.1);
	}
}

@-webkit-keyframes mymove /*Safari and Chrome*/ {
	0% {
		transform: scale(1); /*开始为原始大小*/
	}
	25% {
		transform: scale(1.1); /*放大1.1倍*/
	}
	50% {
		transform: scale(1);
	}
	75% {
		transform: scale(1.1);
	}
}
.u-border-bottom:after {
	border-bottom-width: 0;
}
</style>
